home *** CD-ROM | disk | FTP | other *** search
/ Word Play Farm / Word Play Farm.iso / pc / movies / shared.dxr / 00515_Time and Date Handlers.ls < prev    next >
Encoding:
Text File  |  1996-07-29  |  2.2 KB  |  114 lines

  1. on SetTime
  2.   global gOurOwnTime, gOurOwnDate
  3.   set gOurOwnTime to the time
  4.   set gOurOwnDate to the date
  5. end
  6.  
  7. on setTimeDate ptime, pdate
  8.   global gTemporal
  9.   set lhour to GetTime(ptime)
  10.   if ptime contains "PM" then
  11.     if lhour <> 12 then
  12.       set lhour to lhour + 12
  13.     end if
  14.   else
  15.     if lhour = 12 then
  16.       set lhour to 0
  17.     end if
  18.   end if
  19.   set lseason to GetDate(pdate)
  20.   if (lhour < 6) or (lhour > 20) then
  21.     set gTemporal to lseason + 2
  22.   else
  23.     if (lhour > 8) and (lhour < 18) then
  24.       set gTemporal to lseason + 1
  25.     else
  26.       set gTemporal to lseason
  27.     end if
  28.   end if
  29. end
  30.  
  31. on GetDate pdate
  32.   set lmark to offset("/", pdate)
  33.   set lmonth to chars(pdate, 1, lmark - 1)
  34.   if lmonth < 4 then
  35.     set lseason to 1
  36.   else
  37.     if lmonth < 7 then
  38.       set lseason to 4
  39.     else
  40.       if lmonth < 10 then
  41.         set lseason to 7
  42.       else
  43.         set lseason to 10
  44.       end if
  45.     end if
  46.   end if
  47.   return lseason
  48. end
  49.  
  50. on GetTime ptime
  51.   set lmark to offset(":", ptime)
  52.   set lhour to chars(ptime, 1, lmark - 1)
  53.   return lhour
  54. end
  55.  
  56. on ChangeTime pHourHand, TimeHit
  57.   global gOurOwnTime
  58.   set TimeHit to string(TimeHit)
  59.   play frame "MinuteHand"
  60.   SwapSprite(pHourHand, "H" & TimeHit)
  61.   if gOurOwnTime contains "PM" then
  62.     SetOurTime(TimeHit, "PM")
  63.   else
  64.     SetOurTime(TimeHit, "AM")
  65.   end if
  66. end
  67.  
  68. on SetOurTime NewTime, AMPM
  69.   global gOurOwnTime
  70.   set gOurOwnTime to string(NewTime) & ":" & AMPM
  71. end
  72.  
  73. on ChangeAMPM pIndicator, pAMPM
  74.   global gOurOwnTime
  75.   set TimeHit to GetTime(gOurOwnTime)
  76.   if pAMPM = 1 then
  77.     SwapSprite(pIndicator, "PM")
  78.     SetOurTime(TimeHit, "PM")
  79.   else
  80.     puppetSprite(pIndicator, 0)
  81.     SetOurTime(TimeHit, "AM")
  82.   end if
  83. end
  84.  
  85. on ChangeDate pIndicator, pdate
  86.   global gOurOwnDate
  87.   set pdate to string(pdate) & "/"
  88.   set lseason to GetDate(pdate)
  89.   set lmonth to string(lseason)
  90.   if lseason <> 1 then
  91.     SwapSprite(pIndicator, "Season" & lmonth)
  92.   else
  93.     puppetSprite(pIndicator, 0)
  94.   end if
  95.   set gOurOwnDate to lmonth & "/"
  96. end
  97.  
  98. on CalcMonth seqnum
  99.   if seqnum = 1 then
  100.     set Month to "1/"
  101.   else
  102.     if seqnum = 2 then
  103.       set Month to "4/"
  104.     else
  105.       if seqnum = 3 then
  106.         set Month to "7/"
  107.       else
  108.         set Month to "10/"
  109.       end if
  110.     end if
  111.   end if
  112.   return Month
  113. end
  114.